package com.authenticateCenter.factory;

import com.authenticateCenter.domain.dto.AuthorityModuleDto;
import com.authenticateCenter.domain.entity.AuthorityModule;
import com.authenticateCenter.domain.vo.AuthorityModuleVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author 大忽悠
 * @create 2022/10/19 15:25
 */
public class AuthorityModuleFactory {
    public static AuthorityModuleConvert AUTHORITY_MODULE_CONVERT = Mappers.getMapper(AuthorityModuleConvert.class);

    @Mapper
    public interface AuthorityModuleConvert {
        AuthorityModule toAuthorityModule(AuthorityModuleDto authorityDto);

        @Mappings({
                @Mapping(target = "authorityVoList", ignore = true),
                @Mapping(target = "authorityModuleVoList", ignore = true)
        })
        List<AuthorityModuleVo> toAuthorityModuleVoList(List<AuthorityModule> sonAuthorityModules);
    }
}
